package com.bing.bean.Tpp;

import com.bing.bean.weixin.Article;
import com.bing.utils.Constant;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * Created by Administrator on 2014/12/20.
 */


public class BaiduWeather {
    private int error;
    private String status;
    private Date date;
    private List<WeatherResults> results;


    public int getError() {
        return error;
    }

    public void setError(int error) {
        this.error = error;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public List<WeatherResults> getResults() {
        return results;
    }

    public void setResults(List<WeatherResults> results) {
        this.results = results;
    }

    public List<Article> toArticles() {
        List<Article> articles = new ArrayList<Article>();
        int i = 0;
        for (WeatherData weatherData : results.get(0).getWeather_data()) {
            Article article = new Article();
            if (i == 0) {
                article.setTitle(results.get(0).getCurrentCity() + "  " + weatherData.getDate());
            } else {
                article.setTitle(weatherData.getDate() + weatherData.getWeather() + " " + weatherData.getWind() + " " + weatherData.getTemperature());
            }
            i++;
            article.setDescription(weatherData.getWeather() + " " + weatherData.getWind() + " " + weatherData.getTemperature());
            article.setPicUrl(weatherData.getDayPictureUrl());
            articles.add(article);
            article.setUrl(Constant.website + "tpp/weather/" + results.get(0).getCurrentCity());
        }

        return articles;
    }
}
